package com.hr.mapper;

import com.hr.domain.po.HouseImage;
import com.hr.domain.query.HouseImagePageParams;
import com.hr.domain.vo.HouseImageVO;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
* @author 86150
* @description 针对表【house_image(房源图片表)】的数据库操作Mapper
* @createDate 2025-09-24 14:18:36
* @Entity com.hr.domain.po.HouseImage
*/
@Mapper
public interface HouseImageMapper  {

    /**
     * 分页获取房屋图片列表
     * @param queryParams
     * @return houseImageList
     */
    List<HouseImageVO> getHouseImagePageList(HouseImagePageParams queryParams);

    /**
     * 获取排序序号
     * @param houseId
     * @return sortOrderList
     */
    @Select("SELECT sort_order FROM house_image WHERE house_id = #{houseId}")
    List<Integer> getSortOrder(@Param("houseId") Long houseId);

    /**
     * 添加房屋图片
     * @param houseImage
     * @return row
     */
    @Insert("INSERT INTO house_image (house_id, image_url, sort_order) " +
            "VALUES (#{houseId}, #{imageUrl}, #{sortOrder})")
    int addHouseImage(HouseImage houseImage);

    /**
     * 删除房屋图片
     * @param id
     * @return row
     */
    @Delete("DELETE FROM house_image WHERE id = #{id}")
    int deleteHouseImage(Integer id);

    /**
     * 批量删除房屋图片
     * @param ids
     * @return row
     */
    int deleteHouseImageBatch(@Param("ids") List<Integer> ids);

    /**
     * 获取房屋图片ID
     * @param id
     * @return houseImageIdList
     */
    @Select("SELECT id FROM house_image WHERE house_id = #{id}")
    List<Integer> getHouseImageId(Long id);

    /**
     * 获取房屋图片列表
     * @param houseId
     * @return houseImageList
     */
    @Select("SELECT * FROM house_image WHERE house_id = #{houseId}")
    List<HouseImage> getHouseImageListById(Long houseId);
}




